Skip to content

feat(link-helper): improve ASCII normalization handling - #911

Merged
xoofx merged 3 commits into
xoofx:masterfrom
mos379:Linkhelper
Nov 10, 2025
Merged

xoofx merged 3 commits into
xoofx:masterfrom
mos379:Linkhelper

Conversation

@mos379

@mos379 mos379 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

feat(link-helper): improve ASCII normalization handling

Enhanced the Urilize method to better handle ASCII normalization and special characters. Added support for decomposing characters when allowOnlyAscii is true and skipping diacritical marks. Introduced handling for special German, Scandinavian, and Icelandic characters via new helper methods: IsSpecialScandinavianOrGermanChar and NormalizeScandinavianOrGermanChar.

Reorganized using directives for better clarity. Updated the processing loop in Urilize to handle normalized spans and ASCII equivalents more effectively. These changes improve link generation compatibility across various languages.
#910

Enhanced the `Urilize` method to better handle ASCII normalization and special characters. Added support for decomposing characters when `allowOnlyAscii` is true and skipping diacritical marks. Introduced handling for special German, Scandinavian, and Icelandic characters via new helper methods: `IsSpecialScandinavianOrGermanChar` and `NormalizeScandinavianOrGermanChar`.

Reorganized `using` directives for better clarity. Updated the processing loop in `Urilize` to handle normalized spans and ASCII equivalents more effectively. These changes improve link generation compatibility across various languages.
Comment thread src/Markdig/Helpers/LinkHelper.cs Resolved
@xoofx

xoofx commented Nov 6, 2025

Copy link
Copy Markdown
Owner

Sorry to come back on this only now. Some tests are failing, if you could have a look? Thanks!

@mos379

mos379 commented Nov 6, 2025 •

Copy link
Copy Markdown
Contributor Author

Gotta fix the tests, working on it.
Actually I'll see what Copilot can do :D

mos379 and others added 2 commits November 6, 2025 10:30
Added tests for NormalizeScandinavianOrGermanChar method to validate character normalization for various special characters in both ASCII and non-ASCII contexts.
Updated test cases in `TestUrilizeOnlyAscii_Simple` to reflect
changes in `LinkHelper.Urilize` behavior. Non-ASCII characters
like `æ` and `ø` are now transliterated to their ASCII
equivalents (`ae` and `oe`) instead of being removed.
@xoofx
xoofx merged commit 12590e5 into xoofx:master Nov 10, 2025
@mos379

mos379 commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

Great Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants